#!/usr/bin/env bash

#更新框架
echo "updating framework..."
branch=`git symbolic-ref --short -q HEAD`
if [ $branch == "master" ]
 then
   echo current branch is master, deny pullall for safety!
   exit 1
 else
   echo current branch is $branch
fi
git pull

#更新模块
echo "updating addons..."
cd addons

fileList=`ls`;
for fileName in $fileList;
do
	if test -d $fileName; then
		cd $fileName
		echo "updating $fileName..."
		branch=`git symbolic-ref --short -q HEAD`
        if [ $branch == "master" ]
         then
            echo current branch is master, deny pullall for safety!
         else
            echo current branch is $branch
    	    git pull
        fi
		cd ..
	fi
done

echo "remove runtime..."
rm -rf runtime/cache
rm -rf runtime/temp
